package com.gt.wifimanager;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.view.IWindowManager;
import android.view.Surface;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.TextView;

public class TestActivity extends Activity implements OnClickListener {

	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setOnClickListener(this);
        tv.setText("Sean");
        this.setContentView(tv);

////        android.os.IServiceManager sm = android.os.ServiceManagerNative();
//        try {
//			Process localProcess = Runtime.getRuntime().exec("su");
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
        
	}
	
	

	@Override
	protected void onResume() {
		super.onResume();
		
	}



	public void onClick(View v) {
		IWindowManager windowService = IWindowManager.Stub.asInterface(android.os.ServiceManager.getService(Context.TELEPHONY_SERVICE));
//		IWindowManager windowService = (IWindowManager)this.getSystemService("window");
        try {
        	Log.i("Test", "ROTATION : " + windowService.getRotation());
//        	setRequestedOrientation(Surface.ROTATION_90); 
			windowService.setRotation(Surface.ROTATION_270, false, -1);
		} catch (RemoteException e) {
			e.printStackTrace();
		}
		
//		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);  
	}
	
	
}
